<template>
    <van-popup
            v-model="visible"
            :closeable="false"
            close-icon="close"
            position="bottom"
            class="fullWin"
    >
        <div class="wdp-10">
            <bpm-nav-bar title="选人" :leftArrow="true" @close="close"></bpm-nav-bar>

            <div class="u-list">
                <van-row>
                    <van-col v-for="item in actorUserList" :key="item.userKey" span="6" class="avatar"
                             @click="selectUser(item)">
                        <img src="../../../assets/image/user-images.jpg"/>
                        {{item.name}}
                        <template v-if="item.deptName">/{{item.deptName}}</template>
                        <van-icon v-if="selected.indexOf(item.userKey) != -1">✔</van-icon>
                    </van-col>
                </van-row>
            </div>
        </div>
        <div class="foot">
            <van-tabbar class="py-5">
                <van-tabbar-item @click="close">
                    <van-button icon="passed"></van-button>
                </van-tabbar-item>
            </van-tabbar>
        </div>
    </van-popup>
</template>

<script>

    import bpmNavBar from '../../../components/bpmNavBar';

    export default {
        name: 'flowUserPopup',
        components: {
            bpmNavBar
        },
        props: {
            actorUserList: {
                type: Array,
                default: () => [],
            },
            selected: {
                type: Array,
                default: () => [],
            },
            isRadio: {
                type: Boolean,
                default: false,
            }
        },
        data() {
            return {
                visible: false
            }
        },
        methods: {
            show() {
                this.visible = true;
            },
            close() {
                this.visible = false;
            },
            selectUser(item) {
                this.$emit("selectUser", item);
                if (this.isRadio) {
                    this.close();
                }
            }
        }
    }
</script>
